<?php
/**
 * Created by JetBrains PhpStorm.
 * User: root
 * Date: 13.07.13
 * Time: 16:40
 * To change this template use File | Settings | File Templates.
 */

class Zend_Validate_EmailExists extends Zend_Validate_Abstract{
const EXISTS = 'emailExists';
protected $_messageTemplates =  array(self::EXISTS => "Данный Email не существует");
    public function isValid($value){

        $this->_setValue($value);
        $emailExists = Myblog_Model_Users::emailExists($value);
        if(!empty($emailExists)){
            return true;
        }else{
            $this->_error(self::EXISTS);
            return false;
        }
    }
}